package com.freewater.parking.infrastructure.event;

import com.freewater.parking.domain.common.DomainEvent;
import com.freewater.parking.domain.common.EventQueue;

import java.util.LinkedList;
import java.util.List;

public class SimpleEventQueue implements EventQueue {

    private final LinkedList<DomainEvent> list;

    public SimpleEventQueue() {
        this.list = new LinkedList<>();
    }

    @Override
    public void enqueue(DomainEvent event) {
        list.add(event);
    }

    @Override
    public List<DomainEvent> queue() {
        return list;
    }

    @Override
    public void clear() {
        this.list.clear();
    }
}
